//
//  SendWZViewController.m
//  u76ho
//
//  Created by m-air-01 on 16/1/12.
//  Copyright © 2016年 LV. All rights reserved.
//

#import "SendWZViewController.h"

@interface SendWZViewController ()
<UITableViewDataSource,UITableViewDelegate>
{
    UITableView * _tableView;
}
@end

@implementation SendWZViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self main];
    [self addItems];
    //[self addBackItem];
    self.navigationItem.title = @"发布文字";
   // [self addNavgationBar];
    // Do any additional setup after loading the view.
}
-(void)main
{
    self.view.backgroundColor = [UIColor whiteColor];
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT) style:UITableViewStyleGrouped];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [self.view addSubview:_tableView];
    self.automaticallyAdjustsScrollViewInsets = NO;
}
#pragma mark - -tableViewDelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
//-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    
//}
#pragma mark - createHeaderView
-(UIView *)createHeaderView
{
    CGFloat picWidth = (SCREEN_WIDTH - SIZETO6W(20)*2 - SIZETO6W(10)*3)/4;
    
    //第一个view
    UIView * view1 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 100+SIZETO6H(20)*2)];
    view1.backgroundColor = [UIColor whiteColor];
//    [self.view addSubview:view1];
    //textView
    UITextView * textView = [[UITextView alloc]initWithFrame:CGRectMake(SIZETO6W(20), SIZETO6H(20), SCREEN_WIDTH-SIZETO6W(20)*2, view1.height-SIZETO6H(20)*2)];
    [view1 addSubview:textView];
    
    //第二个view
    UIView * view2 = [[UIView alloc]initWithFrame:CGRectMake(0, view1.bottom, SCREEN_WIDTH, picWidth+SIZETO6H(10))];
    view2.backgroundColor = [UIColor whiteColor];
//    [self.view addSubview:view2];
    //添加图片按钮
    UIButton * addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    addBtn.frame = CGRectMake(SIZETO6W(20), 0, picWidth, picWidth);
    [addBtn setImage:[UIImage imageNamed:@"添加图片图标"] forState:UIControlStateNormal];
    [view2 addSubview:addBtn];
    //分割线
    UIView * lineV = [[UIView alloc]initWithFrame:CGRectMake(SIZETO6W(20), view2.height-1, SCREEN_WIDTH-SIZETO6W(20)*2, 1)];
    lineV.backgroundColor = UIColorFromRGB(0x94999f);
    [view2 addSubview:lineV];
    
    //第三个view
    UIView * view3 = [[UIView alloc]initWithFrame:CGRectMake(0, view2.bottom, SCREEN_WIDTH, 50)];
    view3.backgroundColor = [UIColor whiteColor];
//    [self.view addSubview:view3];
    //同步到我的图集
    UIButton * tongbuBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    tongbuBtn.frame = CGRectMake(SIZETO6W(20), (view3.frame.size.height-40)/2, 40, 40);
    [tongbuBtn setImage:[UIImage imageNamed:@"同步图集-未选中"] forState:UIControlStateNormal];
    [view3 addSubview:tongbuBtn];
    UILabel * tongbuLab = [[UILabel alloc]initWithFrame:CGRectMake(tongbuBtn.right, 0, 100, view3.height)];
    tongbuLab.text = @"同步到我的图集";
    tongbuLab.textColor = UIColorFromRGB(0x333944);
    tongbuLab.textAlignment = NSTextAlignmentCenter;
    [view3 addSubview:tongbuLab];
    //工作图片
    UIButton * selectedBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    selectedBtn.frame = CGRectMake(tongbuLab.right, (view3.frame.size.height-30)/2, 80, 30);
    [selectedBtn setTitle:@"工作图片" forState:UIControlStateNormal];
    [selectedBtn setTitleColor:UIColorFromRGB(0x333944) forState:UIControlStateNormal];
    [selectedBtn setImage:[UIImage imageNamed:@"图集展开案"] forState:UIControlStateNormal];
    selectedBtn.imageView.contentMode = UIViewContentModeRight;
    selectedBtn.titleLabel.textAlignment = NSTextAlignmentLeft;
    selectedBtn.layer.masksToBounds = YES;
    selectedBtn.layer.borderColor = [UIColorFromRGB(0x333944) CGColor];
    selectedBtn.layer.borderWidth = 1.0f;
    [view3 addSubview:selectedBtn];
    //新建图集
    UIButton * newBuildBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    newBuildBtn.frame = CGRectMake(selectedBtn.right, (view3.frame.size.height-30)/2, 80, 30);
    [newBuildBtn setTitle:@"新建图集" forState:UIControlStateNormal];
    [newBuildBtn setTitleColor:UIColorFromRGB(0x6ec844) forState:UIControlStateNormal];
    [view3 addSubview:newBuildBtn];
    
    
    //总view
    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, view3.height+view2.height+view1.height)];
    [self.view addSubview:view];
    [view addSubview:view1];
    [view addSubview:view2];
    [view addSubview:view3];
    
    return view;
}
-(void)addItems
{
    UIButton * cancleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    cancleBtn.frame = CGRectMake(0, 0, 60, 30);
    [cancleBtn setTitle:@"取消" forState:UIControlStateNormal];
    [cancleBtn setTitleColor:UIColorFromRGB(0x333944) forState:UIControlStateNormal];
    UIBarButtonItem * leftItem = [[UIBarButtonItem alloc]initWithCustomView:cancleBtn];
    self.navigationItem.leftBarButtonItem = leftItem;
    
    UIButton * sendBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    sendBtn.frame = CGRectMake(0, 0, 60, 30);
    [sendBtn setTitle:@"发送" forState:UIControlStateNormal];
    [sendBtn setTitleColor:UIColorFromRGB(0x6ec844) forState:UIControlStateNormal];
    UIBarButtonItem * rightItem = [[UIBarButtonItem alloc]initWithCustomView:sendBtn];
    self.navigationItem.rightBarButtonItem = rightItem;
}
#pragma  mark - 返回按钮图标
-(void)addBackItem{
    UIButton * backItem = [UIButton buttonWithType:UIButtonTypeCustom];
    backItem.frame = CGRectMake(0, 0, 9, 17);
    [backItem setImage:[UIImage imageNamed:@"返回图标"] forState:UIControlStateNormal];
    [backItem addTarget:self action:@selector(backItem:) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backItem];
}
-(void)backItem:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
